//引入模块
const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');

//创建服务
let server = express();

//静态资源
server.use(express.static(path.join(__dirname, '../src')));

//中间件
server.use(bodyParser.urlencoded({extended: false}));
server.use(bodyParser.json());

//配置路由
server.use('/account', require('./router/accountRouter').router);

//购物车的路由
server.use('/cart', require('./router/carRouter').router);

//查看商品路由
server.use('/goods', require('./router/goodsRouter').router);

//设置监听
server.listen(8080, function () {
    console.log('服务器启动完成');
})